<!doctype html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta name="renderer" content="webkit" />
	    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width,height=device-height">
        <title>Investor Relationship</title>
        <link href="favicon.ico" rel="shortcut icon">
        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
        <script src="./js/common/vue.js"></script>
        <script src="./js/common/vue-resource.js"></script>
        <link rel="stylesheet" href="css/common/swiper.css">
        <link rel="stylesheet" href="css/common/base.css">
        
        <link rel="stylesheet" href="css/common/media.css">
        <link rel="stylesheet" href="css/ir.css">
    </head>
    <body>
        <div id="contn">
            <v-header></v-header>
            <v-main :parent-nav="nav" :parent-currentind="currentind" :parent-list="list" :parent-pics="pics" :parent-newsnav="newsnav" :parent-whethernext="hasNextPage" :parent-years="years" :parent-monthname="monthname" :parent-choosenyear="choosenyear" :parent-days="days" :parent-choosenday="choosenday" :parent-filtered="filtered" :parent-desc="desc" :parent-ordertransformed="ordertransformed" @myfunc1="loadMoreNews" @myfunc2="calDays" @myfunc3="changeday" @myfunc4="filter" @myfunc5="changeorder" @myfunc6="changeyear"></v-main>
            <v-footer></v-footer>
         </div>
         <template id="vMain">
            <main>
                <div class="heading">
                    <div class="storeBox" v-if="parentNav.length" v-html="parentNav[parentCurrentind].htmlContent"></div>
                    <p class="pic fill"><img v-if="parentNav.length" :src="parentNav[parentCurrentind].imagePath" class="obj-c" alt=""></p>
                    <div class="fluid flex flex-align-items fill">
                        <div class="txt ready">
                             <p class="delay-1" v-if="parentNav.length">{{parentNav[parentCurrentind].enName}}</p>
                             <p class="delay-2"></p>
                        </div>
                    </div>
                </div>
                
                <div id="news">
                    <div class="categories flex flex-align-items flex-justify-content">
                        <a href="ir.html?pointId=news">View All</a>
                        <a :href="item.visitUrl" v-for="(item,i) in parentNewsnav">{{item.name}}</a>
                    </div>
                    <div class="fluid">
                        <div class="control flex flex-align-items">
                            <p class="sequence">
                                <img :src="parentPics[2]" v-if="parentPics.length" title="Ascending Order" @click="myorder('false')" alt="">
                                <img :src="parentPics[3]" v-if="parentPics.length" title="Descending Order" @click="myorder('true')" alt="">
                            </p>
                            <div class="sort">
                                <p class="cursor">
                                    <span>Sort by: Month</span>
                                    <img :src="parentPics[1]" v-if="parentPics.length" alt="">
                                </p>
                                <div class="choose">
                                    <div class="yymm">
                                        <div class="year addFst">
                                            <p :class='[item == parentChoosenyear?"active":""]' v-for="(item,i) in parentYears" @click="myyear(item)" :class='[i == parentChoosenyear?"active":""]'>{{item}}</p>
                                        </div>
                                        <div class="months">
                                            <p v-for="(item,i) in parentMonthname" @click="mycal(i + 1)" class="flex flex-align-items flex-justify-content" >
                                                <span>{{i + 1}}</span>
                                                <span>{{item}}</span>
                                            </p>
                                        </div>
                                    </div>
                                    <div class="day">
                                        <img :src="parentPics[0]" v-if="parentPics.length" alt="back" class="back" >
                                        <ul>
                                            <li v-for="(item,i) in parentDays" :class='[i == parentChoosenday?"active":""]' @click="myday(i)">{{item}}</li>
                                        </ul>
                                        <span class="confirm fillAft" @click="myconfirm">Confirm</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="list">
                            <div :class='["itm",(parentFiltered || parentOrdertransformed) || i > 4?"":"ready"]' v-for="(item,i) in parentList">
                                <div class="inner">
                                    <p class="catePic"><img :src="parentPics[4]" class="hvc" alt=""></p>
                                    <p class="cd">
                                        <span class="cate">{{item.category}}</span> | <span class="date">{{item.date}}</span>
                                    </p>
                                    <p class="title">{{item.title}}</p>
                                    <div class="des">
                                        <p>{{item.description}}...</p>
                                    </div>
                                    <a :href='"article.html?atclId=" + item.id' class="dwld">Read More</a>
                                </div>
                            </div>
                            <p class="noresult" v-if="!parentList.length">No Result</p>
                        </div>
                        <p class="cursor load fillAft" v-if="parentWhethernext" @click="mymore">View More</p>
                    </div>
                </div>
           </main>
         </template>
        

        
        <script src="js/common/swiper.js"></script>
        <script src="js/common/jquery.js"></script>
        <script src="./js/common/dataUrl.js"></script>
        <script src="js/common/header.js"></script>
        <script src="js/common/footer.js"></script>
        <script>
            var viewAll = window.location.href.indexOf('type') < 0?true:false;
            var newsId;
            var size = 0;
            var order
            if(viewAll){
                newsId = 79;
            }else{
                var type = GetQueryString('type');
                if(type == 1){
                    newsId = 89;
                }else{
                    newsId = 88;
                }
            }

            var contn = new Vue({
                el:'#contn',
                data:{
                    currentind:'',
                    choosenyear:'',
                    choosenmonth:'',
                    choosenday:0,
                    nav:[],
                    blocks:[],
                    list:[],
                    loadmore:[],
                    pics:[],
                    newsnav:[],
                    hasNextPage:false,
                    years:[],
                    days:[],
                    monthname:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                    filtered:false,
                    //默认（0）降序
                    desc:true,
                    ordertransformed:false
                },
                methods:{
                    writingWeb:function(){
                        //获取heading
                        axios.get(dataUrl + 'api/getNavbar',{
                            headers:{
                                Authorization: headers
                            }
                        })
                        .then((res) => {
                            //console.log(res.data.data);
                            this.nav = res.data.data;
                            for(var a = 0;a < res.data.data.length;a++){
                                if(window.location.href.indexOf('html') < 0){
                                    this.currentind = 0;
                                }else if(window.location.href.indexOf(res.data.data[a].visitUrl) >= 0){
                                    this.currentind = a;
                                }
                            }
                            setTimeout(function(){
                                $('main .heading .fluid .txt p:eq(1)').text($('main .heading .storeBox p:eq(0)').text());
                                $('main .tips p').text($('main .heading .storeBox p:eq(1)').text());
                            },10)
                        });

                        this.loadMoreNews();

                        //获取新闻导航
                        axios.post(dataUrl + 'api/v2/getNavbarDetails',{id:79,size:0,page:5},{
                            headers:{
                                Authorization: headers
                            }
                        })
                        .then((res) => {
                            //console.log(res.data.data);
                            this.newsnav = res.data.data;
                        });

                        //获取公共图标
                        axios.post(dataUrl + 'api/getBanner',{identification:'OTHER_PICS'},{
                            headers:{
                            Authorization: headers
                            }
                        })
                        .then((res) => {
                            //console.log(res.data.data);
                            for(var n = 0;n < res.data.data.length;n++){
                                if(res.data.data[n].remark == 'ir'){
                                    this.pics.push(res.data.data[n].imgPath);
                                }
                            }
                            setTimeout(function(){
                                $('main #news .sort .day .back').click(function(){
                                    $(this).parents('.choose').removeClass('switch');
                                })
                            },10)
                        });
                        
                        //准备新闻年份
                        axios.post(dataUrl + 'api/v2/getArchives',{id:newsId,size:999,page:1},{
                            headers:{
                                Authorization: headers
                            }
                        })
                        .then((res) => {
                            console.log(res.data.data.list);
                            var list = res.data.data.list;
                            for(var y = 0;y < list.length;y++){
                                var yy = list[y].createTime.split(' ')[0].split('-')[0];
                                if(this.years.indexOf(yy) < 0){
                                    this.years.push(yy);
                                }
                            }
                            this.choosenyear = this.years[0];
                        })
                        
                    },
                    transDate:function(ary){
                        for(var d = 0;d < ary.length;d++){
                                var date = ary[d].createTime.split(' ')[0].split('-');
                                var month = String(parseInt(date[1]));
                                var dateStr = date[2] + ' ';
                                console.log(month);
                                switch(month){
                                    case '1':
                                        dateStr += 'January ';
                                        break;
                                    case '2':
                                        dateStr += 'Feburary ';
                                        break;
                                    case '3':
                                        dateStr += 'March ';
                                        break;
                                    case '4':
                                        dateStr += 'April ';
                                        break;
                                    case '5':
                                        dateStr += 'May ';
                                        break;
                                    case '6':
                                        dateStr += 'June ';
                                        break;
                                    case '7':
                                        dateStr += 'July ';
                                        break;
                                    case '8':
                                        dateStr += 'August ';
                                        break;
                                    case '9':
                                        dateStr += 'September ';
                                        break;
                                    case '10':
                                        dateStr += 'October ';
                                        break;
                                    case '11':
                                        dateStr += 'November ';
                                        break;
                                    case '12':
                                        dateStr += 'December ';
                                        break;
                                }
                                dateStr += date[0];
                                ary[d].date = dateStr;
                            }
                    },
                    loadMoreNews:function(){
                        //获取新闻列表
                        var before = this.list.length;
                        size = (this.list.length + 5);
                        //console.log(this.list.length);
                        axios.post(dataUrl + 'api/v2/getArchives',{desc:this.desc?0:1,id:newsId,size:size,page:1},{
                            headers:{
                                Authorization: headers
                            }
                        })
                        .then((res) => {
                            //console.log(res.data.data);
                            this.hasNextPage = res.data.data.hasNextPage;
                            if(size > 5){
                                for(var a = before;a < res.data.data.list.length;a++){
                                    this.list.push(res.data.data.list[a]);
                                }
                            }else{
                                this.list = res.data.data.list;
                                setTimeout(function(){
                                    if(viewAll){
                                        $('main #news .categories a').eq(0).addClass('active');
                                    }else{    
                                        $('main #news .categories a').eq(parseInt(type) + 1).addClass('active');
                                    }                                    
                                },10);
                            }
                            this.transDate(this.list);
                            
                        })
                        
                    },
                    calDays:function(m){
                        var count;
                        this.choosenmonth = m;
                        this.choosenday = 0;
                        if(m == 2){
                            if((this.choosenyear % 4 == 0 && this.choosenyear % 100 != 0) || this.choosenyear % 400 == 0){
                                count = 29;
                            }else{
                                count = 28;
                            }
                        }else if([4,6,9,11].indexOf(m) >= 0){
                            count = 30
                        }else{
                            count = 31;
                        }
                        this.days = [];
                        for(var d = 1;d <= count;d++){
                            this.days[d - 1] = d;
                        }
                    },
                    changeday:function(d){
                        this.choosenday = d;
                    },
                    filter:function(){
                        //console.log(this.choosenday + 1);
                        this.filtered = true;
                        axios.post(dataUrl + 'api/v2/getArchives',{desc:this.desc?0:1,id:newsId,size:999,page:1},{
                            headers:{
                                Authorization: headers
                            }
                        })
                        .then((res) => {
                            //console.log(res.data.data.list);
                            var list = res.data.data.list;
                            this.list = [];
                            this.hasNextPage = false;
                            for(var n = 0;n < list.length;n++){
                                var date = list[n].createTime.split(' ')[0].split('-');
                                var y = date[0];
                                var m = date[1]
                                var d = date[2];
                                if(this.choosenyear == y && this.choosenmonth == m && this.choosenday + 1 == d){
                                    this.list.push(list[n]);
                                }
                            }
                            this.transDate(this.list);
                        })
                    },
                    changeorder:function(judge){
                        var contrary = false;
                        if(judge == 'false'){
                            if(!this.desc) return false;
                            this.desc = false;
                            contrary = true;
                        }else{
                            if(this.desc) return false;
                            this.desc = true;
                            contrary = true;
                        }
                        if(!this.filtered){
                            if(contrary){
                                this.odertransformed = true;
                                axios.post(dataUrl + 'api/v2/getArchives',{desc:this.desc?0:1,id:newsId,size:size,page:1},{
                                    headers:{
                                        Authorization: headers
                                    }
                                })
                                .then((res) => {
                                    //console.log(res.data.data);
                                    this.list = [];
                                    this.hasNextPage = res.data.data.hasNextPage;
                                    this.list = res.data.data.list;
                                    this.transDate(this.list);
                                })
                            }
                        }else{
                            this.filter();
                        }
                        
                    },
                    changeyear:function(y){
                        this.choosenyear = y;
                    }
                },
                created:function(){
                    this.writingWeb();
                },
                mounted:function(){
                    ifMounted = true;
                },
                components:{
                    vMain:{
                        template: '#vMain',
                        methods:{
                            mymore:function(){
                                this.$emit('myfunc1');
                            },
                            mycal:function(m){
                                this.$emit('myfunc2',m);
                            },
                            myday:function(d){
                                this.$emit('myfunc3',d);
                            },
                            myconfirm:function(){
                                this.$emit('myfunc4');
                            },
                            myorder:function(judge){
                                this.$emit('myfunc5',judge);
                            },
                            myyear:function(y){
                                this.$emit('myfunc6',y);
                            }
                        },
                        props:['parentNav','parentCurrentind','parentList','parentPics','parentNewsnav','parentWhethernext','parentYears','parentMonthname','parentChoosenyear','parentDays','parentChoosenday','parentFiltered','parentDesc','parentOrdertransformed'],
                    }
                },
            })
        </script>
        <script src="js/common/common.js"></script>
        <script src="js/common/animation.js"></script>
        <script src="js/ir.js"></script>
    </body>
</html>